<?xml version="1.0" encoding="ISO-8859-1" ?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">

	<div class="linkBox">
		<div class="votesAndScore">
			<h:form name="form">
				<h:commandLink styleClass="upVote" update=":form">
					<f:param name="id" value="#{entry.id}" />
					<f:ajax event="click" listener="#{entryBean.voteUp(entry.id)}"
						render="numberOfVotes" />
				</h:commandLink>
				<h:outputText styleClass="score" id="numberOfVotes"
					value="#{entry.score}" />
				<h:commandLink styleClass="downVote">
					<f:param name="id" value="#{entry.id}" />
					<f:ajax event="click" listener="#{entryBean.voteDown(entry.id)}"
						render="numberOfVotes" />
				</h:commandLink>
			</h:form>
		</div>
		<div class="linkTitle">
			<h1>
				<a href="#{entry.url}" target="_blank">#{entry.title}</a>
			</h1>
			<div class="commentDescription">
				<span class="bold greyedOut">#{entry.createdString}</span>
				<div>
					<c:choose>
						<c:when test="#{detail}">
							<c:if test="#{userBean.loggedIn}">
								<div class="replyLink greyedOut">
									<a onclick="displayCommentBox(this);">reply</a>
								</div>
								<div class="replyBox" style="display: none;">
									<img src="/WhiteIt/img/message.png" alt="message" height="50px"
							style="float: left; margin: 20px;" />
									<h:form class="greyForm">

										<h:inputTextarea value="#{entryBean.commentText}" />

										<h:commandLink value="Comment" action="${entryBean.rateEntry}"
											styleClass="headerlinks">
											<f:param name="ratedEntry" value="#{entry.id}" />
											<f:param name="user" value="#{userBean.username}" />
										</h:commandLink>
									</h:form>
								</div>
							</c:if>
						</c:when>
						<c:otherwise>
							<h:form>
								<h:commandLink
									value="#{entryBean.getCommentCountByEntryId(entry.id)} Comments"
									action="${userBean.showEntry(entry.id)}">
									<f:param name="id" value="#{entry.id}" />
								</h:commandLink>
							</h:form>
						</c:otherwise>
					</c:choose>
				</div>
			</div>
		</div>
	</div>
</ui:composition>